<?php 
/*------------------------------------------------------------------------
# mod_vportfolio - VPortfolio Module
# ------------------------------------------------------------------------
# author    Vsmart Extensions
# copyright Copyright (C) 2010 www.vsmart-extensions.com. All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Websites: http://www.vsmart-extensions.com
# Technical Support:  Forum - http://www.vsmart-extensions.com
-------------------------------------------------------------------------*/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
$auto_slide = 'false';
$n = count($rows);
$item_witdh = $params->get( 'width')+6;
$module_witdh = $params->get( 'modulewidth');
$top_prev_next = $params->get( 'width')/2 - 10;
$content_height = $params->get( 'width') + 60;
$title_width = $params->get( 'width')-10;
$autoSpeed = $params->get( 'auto_silde_speed',2);
//-------------
if($params->get( 'auto_silde') ==1) $auto_slide = 'true';
$js='
	window.onload = function() 
	{
		initSlideShow();		
	}
	var autoSpeed = '.$autoSpeed.'
	var itemLength = '.$item_witdh.'
	var itemsLength = '.$n*$item_witdh.'
	var autoStart = '.$auto_slide.';
	
	//alert(autoStart);
';
//-------------
$css='
#portfolio-relative{
	width:'.$module_witdh.'px;
}
.portfolio-item{
	width:'.$item_witdh.'px;
}
#portfolio-prev, #portfolio-next {
	top:'.$top_prev_next.'px;
}
#portfolio-content{
	height:'.$content_height.'px;
}
.title-item{
	width:'.$title_width.'px;
}
';
$doc = JFactory::getDocument();
$doc->addScriptDeclaration($js);
$doc->addStyleDeclaration($css);
$url = JURI::base();
?>

<div id="portfolio-wrapper">	
	<div class="portfolio">		
		<div class="portfolio-header clearfix">
		<table>
			<tr>
			<td class="td_title">
			<h2 class="portfolio-title">
				<?php 	
						echo $module->title;
				?>
			</h2> 
			</td>
			<td>
			<p class="portfolio-description"><?php echo htmlspecialchars_decode($params->get('description'));?></p>
			</td>
			</tr>
		</table>
		</div>
		<div class="clear"></div>
		<div id="portfolio-content" >			
			
			<a id="portfolio-prev" title="Previous" href="javascript:void(0);"></a>	
			<a id="portfolio-next" title="Next" href="javascript:void(0);"></a>	
			<div id="portfolio-relative">
			<ul id="portfolio-content-content">				
				<?php for ($i = 0; $i < $n ; $i ++) : 
				if($valueConfig==1) :
					$listImage = modVstPortfolioHelper::getListImages($rows[$i]->id);					
				?>				
					<li class="portfolio-item">
						<a rel="prettyPhoto[gallery<?php echo $i.vst?>]" class="image-item" href="<?php echo $url."components/com_vportfolio/images/".$rows[$i]->id."/".$listImage[0]->imageName; ?>">
							<img alt="<?php echo $rows[$i]->title;?>" width="<?php echo $params->get( 'width');?>" height="<?php echo $params->get( 'height');?>" src="<?php $portfolio_title = str_replace(' ', '_',$rows[$i]->title); echo  JURI::base().'modules/mod_vportfolio/images/'.$rows[$i]->id.'_'.$portfolio_title.'_'.$rows[$i]->name; ?>"/>
						</a>
						<div class="sub-image-hidden">
							<?php							
								for($j=1; $j<sizeof($listImage);$j++){ ?>
									<a rel="prettyPhoto[gallery<?php echo $i.vst?>]" href="<?php echo $url."components/com_vportfolio/images/".$rows[$i]->id."/".$listImage[$j]->imageName; ?>">
										<img src="<?php echo $url."components/com_vportfolio/images/".$rows[$i]->id."_".str_replace(" ","_",$rows[$i]->title)."/".$listImage[$j]->imageName; ?>" >
									</a>
								<?php } ?>
						</div>
						<div class="title-item">
							<a href="<?php echo JRoute::_('index.php?option=com_vportfolio&task=view&id='.$rows[$i]->id.'&Itemid='.$itemId);?> ">
								<?php echo $rows[$i]->title;?>				
							</a>
						</div>
					</li>
					
				<?php else : ?>
				
				<li class="portfolio-item">
					<a class="image-item" href="<?php echo JRoute::_('index.php?option=com_vportfolio&task=view&id='.$rows[$i]->id.'&Itemid='.$itemId);?> ">
						<img alt="<?php echo $rows[$i]->title;?>" width="<?php echo $params->get( 'width');?>" height="<?php echo $params->get( 'height');?>" src="<?php $portfolio_title = str_replace(' ', '_',$rows[$i]->title); echo  JURI::base().'modules/mod_vportfolio/images/'.$rows[$i]->id.'_'.$portfolio_title.'_'.$rows[$i]->name; ?>"/>
					</a>					
					<div class="title-item">
						<a href="<?php echo JRoute::_('index.php?option=com_vportfolio&task=view&id='.$rows[$i]->id.'&Itemid='.$itemId);?> ">
							<?php echo $rows[$i]->title;?>				
						</a>
					</div>
				</li>
				
				<?php endif; ?>
				<?php endfor; ?>
				
				
			</ul>
			</div>
		</div>
		
	</div>
</div>

